/*访问后台的代码*/
layui.define([], function(exports) {
    var api={
            updateBanner:function(form,callback){
                Lib.submitForm("/banner/banner/update.json",form,{},callback)
            },
            saveForm:function(isNew,form,callback){

                if( $("#type").val()!=6) {
                    var href = $("#href").val();
                    if (href==null||href=="") {
                        if( $("#type").val()==1){
                            layer.tips('请填写跳转值', '#href1');
                            return;
                        }else {
                            layer.tips('请填写跳转值', '#href2Div');
                            return;
                        }
                    }
                }

                var mainImg = $("#bannerPathView").attr("src");
                if(mainImg==null||mainImg==""){
                    layer.tips('请上传图片', '#bannerPath');
                    return;
                }
                var postUrl = "/banner/banner/update.json";
                if (isNew) {
                    postUrl = "/banner/banner/add.json";
                }

                Lib.submitFileForm(postUrl,form,{},callback)
            },
            del:function(ids,callback){
                Common.post("/banner/banner/delete.json",{"ids":ids},function(){
                    callback();
                })
            }
		
    };
    exports('bannerApi',api);
});